{% extends "departamento/index.html" %}
{% load i18n %}
{% block title %} Página de Confirmação de adicionar serviço docente (Departamento) {% endblock %}

{% block breadcrumb %}
<ul id="breadcrumb">
	<li>
		<a tabindex="2" href="{% url homeDepartamento %}" title="{% trans 'Home' %}"> <img src="/static/images/BreadCrumbs/home.gif" alt="{% trans 'Home' %}" class="home" /> </a>
	</li>

	<li>
		Confirmação dados Serviço Docente
	</li>
</ul>

{% endblock %}

{% block content %}
<table class="tabela_sumario">
	<tr>
		<th colspan="2" class="top_sumario">Adicionar Serviço Docente</th>
	</tr>
</table>

<div id="contentForm">
	<form method="post">
		{% csrf_token %}

		<div class="teachersDiv">

			<table class="tabela_sumario teachersTable">
				<tr>
					<th class="idHide" ></th>
					<th>Docente</th>
					<th>Horas</th>
				</tr>

				{%for docente in listaDocentes %}
				<tr class="docenteRow" onclick="highlight(this);">
					<td class="idHide">{{docente.id}}</td>
					<td >{{docente.nome_completo}}</td>
					<td>{{docente.horas}}</td>
				</tr>
				{%endfor %}
			</table>

		</div>
		<div class="servicoControls">
			<input id="addDocenteDepButton" type="button" onclick="addDocente_to_modul();" />
		</div>
		<div class="modulsDiv">
			{% for id, horas, docente_id, servico_id, nome, horasDocente, departament, depChoice in lModulos %}
			<table class="tabela_sumario modulsTable {% if departament != None and departament.id != id_departamento %}haveDelegate{% endif %}" onclick="highlightModul(this);">
				<tr >
					<th  colspan="3">Modulo de {{horas}} horas</th>

				</tr>

				<tr>

					<th class="docenteRow" >Docente</th>
					<th>Horas</th>

					<th>
					<input type="hidden" value="{{id}}" name="moduloID[]" />
					</th>

				</tr>
			

				{% if docente_id != None and  docente_id != "" %}
				
				<tr>

					<td class="idHide">
					<input type='text' name='docenteID[]' value="{{docente_id}}" />
					</td>
					<td>{{nome}}</td>
					<td>{{horasDocente}}</td>
					<td><a href='#' onclick='deleteRowTable(this.parentNode.parentNode.parentNode);'><span class='delButton'></span></a></td>

				</tr>
				{%else%}

				<tr>

					<td class="idHide">
					<input type='text' name='docenteID[]' value="" />
					</td>
					<td></td>
					<td></td>
					<td></td>

				</tr>

				{%endif%}
				{% if departament == None%}
				
					{% if depChoice == 0 %}
						
					<tr class="hideDelegate">

						<td class="idHide" >
						<input type='text"' name='delegateDep[]' value="0" />
						</td>
					
						<td colspan="2"></td>
						<td></td>
						</tr>
					{% else %}
				
			
					<tr class="showDelegate">

					<td colspan="2"><select onchange="testeSearch();" name="delegateDep[]"> 
				{% for dep in depList %}
					
					{% if dep.id == depChoice %}
						
					<option   selected="selected" value="{{dep.id}}">{{dep.nome}}</option>
					{%else%}
					<option  value="{{dep.id}}">{{dep.nome}}</option>
					{% endif %}
							{% endfor %}
					</select></td>
					<td><a href="#" onclick="rolebackDelegate(this.parentNode.parentNode);" ><span class='delButton'></span></a></td>
									
					
					</tr>
					{% endif %}
			
				
				{% else %}
				
					<tr class="showDelegate blockDelegate">

					<td class="idHide" >
					<input type='text"' name='delegateDep[]' value="{{departament.id}}" />
					</td>
					
					<td colspan="3">{{departament.nome}}</td>
					
					

				</tr>
				
				{% endif%}
				

			</table>

			<hr />
			{% endfor %}

		</div>

		<div id="buttonConfirm">
			<hr />
			<span id = "Confirmacao">Deseja submeter os Dados dos Formulário?</span>
			<input type="hidden" name="{{ stage_field }}" value="2" />
			<input type="hidden" name="{{ hash_field }}" value="{{ hash_value }}" />
			<input type="button" value="{% trans 'Não' %}" onClick="javascript:history.go(-1);">
			<input type="submit" value="{% trans 'Sim' %}" />
		</div>

	</form>
	<script>
		initial();
		changeCountValue();
	</script>
</div>
{% endblock %}